package com.py.credit.controller;

import com.alibaba.fastjson.JSONArray;
import com.py.credit.common.Page;
import com.py.credit.common.logs.ExceptionLogger;
import com.py.credit.common.rest.RestServiceResult;
import com.py.credit.entity.MsgContentEntity;
import com.py.credit.entity.MsgDetailEntity;
import com.py.credit.entity.Removal;
import com.py.credit.entity.SysUser;
import com.py.credit.entity.common.OptionalColumn;
import com.py.credit.entity.enums.RemovalCjFrTableFieldEnum;
import com.py.credit.entity.enums.RemovalCjZrrTableFieldEnum;
import com.py.credit.entity.enums.RemovalJlFrTableFieldEnum;
import com.py.credit.entity.enums.RemovalJlZrrTableFieldEnum;
import com.py.credit.service.LhjcRemoteBaseService;
import com.py.credit.service.OfficeService;
import com.py.credit.service.RemovalService;
import com.py.credit.service.SyslogService;
import com.py.credit.service.impl.LhjcExceedFailureSchedule;
import com.py.credit.utils.ExcelUtil;
import com.py.credit.utils.MapCache;
import com.py.framework.core.helper.HttpServletHelper;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;

@Controller
@RequestMapping("/removal")
public class RemovalController {

    private final static String FRONT_TABLE_RMOVAL_CJFR_ID = "rmovalcjfr";

    private final static String FRONT_TABLE_RMOVAL_CJZRR_ID = "rmovalcjzrr";

    private final static String FRONT_TABLE_RMOVAL_JLFR_ID = "rmovaljlfr";

    private final static String FRONT_TABLE_RMOVAL_JLZRR_ID = "rmovaljlzrr";

    @Autowired
    private RemovalService removalService;

    @Autowired
    private SyslogService syslogService;

    @Autowired
    private OfficeService officeService;

    @Autowired
    private LhjcRemoteBaseService lhjcRemoteBaseService;

    @Autowired
    private LhjcExceedFailureSchedule lhjcExceedFailureSchedule;

    /**
     * 联合奖惩名单移出普通检索
     *
     * @param jclb 奖惩类别：C:惩戒 J:激励
     * @param type 主体类型：C：法人 P:自然人
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/getOptionalColums.json")
    public RestServiceResult getOptionalColums(@RequestParam(value = "jclb", defaultValue = "", required = true) String jclb,
                                               @RequestParam(value = "type", defaultValue = "", required = true) String type) {
        if (jclb.equals("C") && type.equals("C")) {
            return new RestServiceResult(RemovalCjFrTableFieldEnum.getOptionalColumns());
        } else if (jclb.equals("C") && type.equals("P")) {
            return new RestServiceResult(RemovalCjZrrTableFieldEnum.getOptionalColumns());
        } else if (jclb.equals("J") && type.equals("C")) {
            return new RestServiceResult(RemovalJlFrTableFieldEnum.getOptionalColumns());
        } else {
            return new RestServiceResult(RemovalJlZrrTableFieldEnum.getOptionalColumns());
        }
    }

    /**
     * 联合奖惩名单移出高级检索
     *
     * @param jclb 奖惩类别：C:惩戒 J:激励
     * @param type 主体类型：C：法人 P:自然人
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/getAdvancedConditionColumns.json")
    public RestServiceResult getAdvancedConditionColumns(@RequestParam(value = "jclb", defaultValue = "", required = true) String jclb,
                                                         @RequestParam(value = "type", defaultValue = "", required = true) String type) {
        if (jclb.equals("C") && type.equals("C")) {
            return new RestServiceResult(RemovalCjFrTableFieldEnum.getAdvancedConditionColumns());
        } else if (jclb.equals("C") && type.equals("P")) {
            return new RestServiceResult(RemovalCjZrrTableFieldEnum.getAdvancedConditionColumns());
        } else if (jclb.equals("J") && type.equals("C")) {
            return new RestServiceResult(RemovalJlFrTableFieldEnum.getAdvancedConditionColumns());
        } else {
            return new RestServiceResult(RemovalJlZrrTableFieldEnum.getAdvancedConditionColumns());
        }
    }

    /**
     * 联合奖惩名单移出查询分页列表
     *
     * @param jclb      奖惩类别：C:惩戒 J:激励
     * @param type      主体类型：C：法人 P:自然人
     * @param condition 搜索条件
     * @param page      分页条件
     * @param request
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/list.json")
    public RestServiceResult getList(@RequestParam(value = "jclb", defaultValue = "", required = true) String jclb,
                                     @RequestParam(value = "type", defaultValue = "", required = true) String type,
                                     @RequestParam(value = "condition", defaultValue = "", required = true) String condition,
                                     Page page, HttpServletRequest request) {
        RestServiceResult<SysUser> user = lhjcRemoteBaseService.getCurrentUser(HttpServletHelper.getUserToken(request));
        String[] configColumns = null;
        List<String> showColumns = null;
        String deptId = null;

        if (RestServiceResult.CODE_SUCCESS == user.getCode()) {
            SysUser userInfo = user.getData();
            if (null != userInfo) {
                deptId = officeService.selectTopDeptId(userInfo.getOfficeId() + "");

                if (jclb.equals("C") && type.equals("C")) {
                    configColumns = (String[]) MapCache.get(userInfo.getId() + "_" + FRONT_TABLE_RMOVAL_CJFR_ID);
                    showColumns = (configColumns == null || configColumns.length == 0)
                            ? RemovalCjFrTableFieldEnum.getDefaultShowColumnEN() : Arrays.asList(configColumns);
                } else if (jclb.equals("C") && type.equals("P")) {
                    configColumns = (String[]) MapCache.get(userInfo.getId() + "_" + FRONT_TABLE_RMOVAL_CJZRR_ID);
                    showColumns = (configColumns == null || configColumns.length == 0)
                            ? RemovalCjZrrTableFieldEnum.getDefaultShowColumnEN() : Arrays.asList(configColumns);
                } else if (jclb.equals("J") && type.equals("C")) {
                    configColumns = (String[]) MapCache.get(userInfo.getId() + "_" + FRONT_TABLE_RMOVAL_JLFR_ID);
                    showColumns = (configColumns == null || configColumns.length == 0)
                            ? RemovalJlFrTableFieldEnum.getDefaultShowColumnEN() : Arrays.asList(configColumns);
                } else {
                    configColumns = (String[]) MapCache.get(userInfo.getId() + "_" + FRONT_TABLE_RMOVAL_JLZRR_ID);
                    showColumns = (configColumns == null || configColumns.length == 0)
                            ? RemovalJlZrrTableFieldEnum.getDefaultShowColumnEN() : Arrays.asList(configColumns);
                }
            } else {
                ExceptionLogger.error("IntegratedQueryController#getList", "未获取到当前用户信息！");
            }
        } else {
            ExceptionLogger.error("IntegratedQueryController#getList", "未获取到当前用户信息！");
        }

        String[] additionalColumns = {"id"};

        List<Map<String, Object>> integratedQuery = removalService.selectByConditionForPage(deptId, jclb, type, showColumns, additionalColumns, condition, page);

        return new RestServiceResult(page.getTotalCount(), integratedQuery);
    }

    /**
     * 联合奖惩名单移出
     *
     * @param ajbh    事件编号
     * @param request
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/update.json")
    public RestServiceResult modify(@RequestParam(defaultValue = "", required = true, value = "ajbhs") String ajbhs,
                                    @RequestParam(defaultValue = "", required = true, value = "description") String description,
                                    HttpServletRequest request) {
        RestServiceResult<SysUser> user = lhjcRemoteBaseService.getCurrentUser(HttpServletHelper.getUserToken(request));
        SysUser userInfo = null;

        if (RestServiceResult.CODE_SUCCESS == user.getCode()) {
            userInfo = user.getData();
            if (null != userInfo) {

            } else {
                ExceptionLogger.error("IntegratedQueryController#getList", "未获取到当前用户信息！");
                return new RestServiceResult(RestServiceResult.CODE_UNKNOW, "未获取到当前用户信息！");
            }
        } else {
            ExceptionLogger.error("IntegratedQueryController#getList", "未获取到当前用户信息！");
            return new RestServiceResult(RestServiceResult.CODE_UNKNOW, "未获取到当前用户信息！");
        }
        List<String> ajbhsList = java.util.Arrays.asList(ajbhs.split(","));
    	for(String ajbh:ajbhsList) {
        Removal removal = removalService.selectInfo(ajbh);
        Integer mbId = null;

        if(removal.getJclb().equals("C")){
            mbId=removalService.selectMbId("A");
        }else{
            mbId=removalService.selectMbId("O");
        }

        if(mbId==null){
            List<String> ajbhList = new ArrayList<String>();
            if (removal.getIs_associated().equals("Y")) {
                String[] list = removal.getGlcf().split(",");
                for (int i = 0; i < list.length; i++) {
                    ajbhList.add(list[i]);
                }

                ajbhList.add(ajbh);

                for (int i = 0; i < ajbhList.size(); i++) {
                    removalService.update(ajbhList.get(i));
                    Removal removalInfo = removalService.selectInfo(ajbhList.get(i));
                    syslogService.addYcProcess(ajbhList.get(i), "C" + removalInfo.getJclb(), "Y", userInfo.getUsername(), userInfo.getRealName(), userInfo.getId(), userInfo.getOfficeId(),description);
                }
            }else{
                removalService.update(ajbh);
                syslogService.addYcProcess(ajbh, "C" + removal.getJclb(), "Y", userInfo.getUsername(), userInfo.getRealName(), userInfo.getId(), userInfo.getOfficeId(),description);
            }

            return new RestServiceResult(RestServiceResult.CODE_SUCCESS);
        }

        List<String> ajbhList = new ArrayList<String>();
        if (removal.getIs_associated().equals("Y")) {
            String[] list = removal.getGlcf().split(",");
            for (int i = 0; i < list.length; i++) {
                ajbhList.add(list[i]);
            }

            ajbhList.add(ajbh);
            for (int i = 0; i < ajbhList.size(); i++) {
                removalService.update(ajbhList.get(i));
                List<Long> dept = removalService.selectDpet(ajbhList.get(i));
                HashSet h = new HashSet(dept);
                dept.clear();
                dept.addAll(h);

                HashSet<Long> managerIdList=new HashSet<Long>();

                Removal removalInfo = removalService.selectInfo(ajbhList.get(i));
                if (dept.contains(-1L)) {
                    List<MsgContentEntity> msgContentEntityList = new ArrayList<MsgContentEntity>();
                    List<Long> allTopDeptId = officeService.selectAllTopDeptId();

                    for (Long id:allTopDeptId){
                        List<Long> managerList = lhjcRemoteBaseService.getDeptManager(StringUtils.join(officeService.selectTopAndDownwardId(id), ","), HttpServletHelper.getUserToken(request));

                        if(managerList==null || managerList.size()==0){
                            continue;
                        }

                        managerIdList.addAll(managerList);
                    }

                    if(managerIdList.size()!=0){
                        MsgContentEntity msgContentEntity = new MsgContentEntity();
                        if (removalInfo.getJclb().equals("C")) {
                            msgContentEntity.setMsgTitle("惩戒名单移出");
                            msgContentEntity.setMsgTypeS("A");
                        } else {
                            msgContentEntity.setMsgTitle("激励名单移出");
                            msgContentEntity.setMsgTypeS("O");
                        }

                        msgContentEntity.setMsgContent(removalService.getContent(syslogService.selectMbInfo(mbId), ajbhList.get(i),removalInfo.getJclb(),removalInfo.getZtmc(),removalInfo.getDeptname(),removalInfo.getStatus()));
                        msgContentEntity.setMsgType(4);
                        msgContentEntity.setSendId(userInfo.getId());
                        msgContentEntity.setSendName(userInfo.getRealName());

                        List<MsgDetailEntity> msgDetailEntityList = new ArrayList<MsgDetailEntity>();

                        for (Long managerId : managerIdList) {
                            MsgDetailEntity msgDetailEntity = new MsgDetailEntity();
                            msgDetailEntity.setReviever(managerId);
                            msgDetailEntity.setRevieveType(1);
                            msgDetailEntityList.add(msgDetailEntity);
                        }

                        msgContentEntity.setDetails(msgDetailEntityList);
                        msgContentEntityList.add(msgContentEntity);
                    }

                    lhjcRemoteBaseService.sendMsg(msgContentEntityList, HttpServletHelper.getUserToken(request));
                } else {
                    List<MsgContentEntity> msgContentEntityList = new ArrayList<MsgContentEntity>();
                    for (Long id : dept
                            ) {
                        List<Long> topAndDownwardIdList = officeService.selectTopAndDownwardId(id);
                        List<Long> managerList = lhjcRemoteBaseService.getDeptManager(StringUtils.join(topAndDownwardIdList, ","), HttpServletHelper.getUserToken(request));

                        if(managerList==null || managerList.size()==0){
                            continue;
                        }

                        managerIdList.addAll(managerList);
                    }

                    if(managerIdList.size()!=0){
                        MsgContentEntity msgContentEntity = new MsgContentEntity();
                        if (removalInfo.getJclb().equals("C")) {
                            msgContentEntity.setMsgTitle("惩戒名单移出");
                            msgContentEntity.setMsgTypeS("A");
                        } else {
                            msgContentEntity.setMsgTitle("激励名单移出");
                            msgContentEntity.setMsgTypeS("O");
                        }

                        msgContentEntity.setMsgContent(removalService.getContent(syslogService.selectMbInfo(mbId),ajbhList.get(i),removalInfo.getJclb(),removalInfo.getZtmc(),removalInfo.getDeptname(),removalInfo.getStatus()));
                        msgContentEntity.setMsgType(4);
                        msgContentEntity.setSendId(userInfo.getId());
                        msgContentEntity.setSendName(userInfo.getRealName());

                        List<MsgDetailEntity> msgDetailEntityList = new ArrayList<MsgDetailEntity>();

                        for (Long managerId : managerIdList) {
                            MsgDetailEntity msgDetailEntity = new MsgDetailEntity();
                            msgDetailEntity.setReviever(managerId);
                            msgDetailEntity.setRevieveType(1);
                            msgDetailEntityList.add(msgDetailEntity);
                        }

                        msgContentEntity.setDetails(msgDetailEntityList);
                        msgContentEntityList.add(msgContentEntity);
                    }

                    lhjcRemoteBaseService.sendMsg(msgContentEntityList, HttpServletHelper.getUserToken(request));
                }

                syslogService.addYcProcess(ajbhList.get(i), "C" + removalInfo.getJclb(), "Y", userInfo.getUsername(), userInfo.getRealName(), userInfo.getId(), userInfo.getOfficeId(),description);
            }
        } else {
            removalService.update(ajbh);
            List<Long> dept = removalService.selectDpet(ajbh);
            HashSet h = new HashSet(dept);
            dept.clear();
            dept.addAll(h);

            HashSet<Long> managerIdList=new HashSet<Long>();

            if (dept.contains(-1L)) {
                List<MsgContentEntity> msgContentEntityList = new ArrayList<MsgContentEntity>();
                List<Long> allTopDeptId = officeService.selectAllTopDeptId();

                for (Long id:allTopDeptId){
                    List<Long> managerList = lhjcRemoteBaseService.getDeptManager(StringUtils.join(officeService.selectTopAndDownwardId(id), ","), HttpServletHelper.getUserToken(request));

                    if(managerList==null || managerList.size()==0){
                        continue;
                    }

                    managerIdList.addAll(managerList);
                }

                if(managerIdList.size()!=0){
                    MsgContentEntity msgContentEntity = new MsgContentEntity();
                    if (removal.getJclb().equals("C")) {
                        msgContentEntity.setMsgTitle("惩戒名单移出");
                        msgContentEntity.setMsgTypeS("A");
                    } else {
                        msgContentEntity.setMsgTitle("激励名单移出");
                        msgContentEntity.setMsgTypeS("O");
                    }

                    msgContentEntity.setMsgContent(removalService.getContent(syslogService.selectMbInfo(mbId), ajbh,removal.getJclb(),removal.getZtmc(),removal.getDeptname(),removal.getStatus()));
                    msgContentEntity.setMsgType(4);
                    msgContentEntity.setSendId(userInfo.getId());
                    msgContentEntity.setSendName(userInfo.getRealName());

                    List<MsgDetailEntity> msgDetailEntityList = new ArrayList<MsgDetailEntity>();

                    for (Long managerId : managerIdList) {
                        MsgDetailEntity msgDetailEntity = new MsgDetailEntity();
                        msgDetailEntity.setReviever(managerId);
                        msgDetailEntity.setRevieveType(1);
                        msgDetailEntityList.add(msgDetailEntity);
                    }

                    msgContentEntity.setDetails(msgDetailEntityList);
                    msgContentEntityList.add(msgContentEntity);
                }

                lhjcRemoteBaseService.sendMsg(msgContentEntityList, HttpServletHelper.getUserToken(request));
            } else {
                List<MsgContentEntity> msgContentEntityList = new ArrayList<MsgContentEntity>();

                for (Long id : dept
                        ) {
                    List<Long> topAndDownwardIdList = officeService.selectTopAndDownwardId(id);
                    List<Long> managerList = lhjcRemoteBaseService.getDeptManager(StringUtils.join(topAndDownwardIdList, ","), HttpServletHelper.getUserToken(request));

                    if(managerList==null || managerList.size()==0){
                        continue;
                    }

                    managerIdList.addAll(managerList);
                }

                if(managerIdList.size()!=0){
                    MsgContentEntity msgContentEntity = new MsgContentEntity();
                    if (removal.getJclb().equals("C")) {
                        msgContentEntity.setMsgTitle("惩戒名单移出");
                        msgContentEntity.setMsgTypeS("A");
                    } else {
                        msgContentEntity.setMsgTitle("激励名单移出");
                        msgContentEntity.setMsgTypeS("O");
                    }

                    msgContentEntity.setMsgContent(removalService.getContent(syslogService.selectMbInfo(mbId),ajbh,removal.getJclb(),removal.getZtmc(),removal.getDeptname(),removal.getStatus()));
                    msgContentEntity.setMsgType(4);
                    msgContentEntity.setSendId(userInfo.getId());
                    msgContentEntity.setSendName(userInfo.getRealName());

                    List<MsgDetailEntity> msgDetailEntityList = new ArrayList<MsgDetailEntity>();

                    for (Long managerId : managerIdList) {
                        MsgDetailEntity msgDetailEntity = new MsgDetailEntity();
                        msgDetailEntity.setReviever(managerId);
                        msgDetailEntity.setRevieveType(1);
                        msgDetailEntityList.add(msgDetailEntity);
                    }

                    msgContentEntity.setDetails(msgDetailEntityList);
                    msgContentEntityList.add(msgContentEntity);
                }

                lhjcRemoteBaseService.sendMsg(msgContentEntityList, HttpServletHelper.getUserToken(request));
            }

            syslogService.addYcProcess(ajbh, "C" + removal.getJclb(), "Y", userInfo.getUsername(), userInfo.getRealName(), userInfo.getId(), userInfo.getOfficeId(),description);
        }
    	}
        return new RestServiceResult(RestServiceResult.CODE_SUCCESS);
    }

    /**
     * 自定义列表选项
     *
     * @param jclb    奖惩类别：C:惩戒，J:激励
     * @param type    主体类型：C：法人 P:自然人
     * @param columns 列表数组
     * @param request
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/addShowColunms.json")
    public RestServiceResult<String> addShowColunms(@RequestParam(value = "jclb", defaultValue = "", required = true) String jclb,
                                                    @RequestParam(value = "type", defaultValue = "", required = true) String type,
                                                    @RequestParam(value = "columns", required = true) String[] columns,
                                                    HttpServletRequest request) {

        RestServiceResult<SysUser> user = lhjcRemoteBaseService.getCurrentUser(HttpServletHelper.getUserToken(request));

        if (RestServiceResult.CODE_SUCCESS == user.getCode()) {

            SysUser userInfo = user.getData();

            if (null != userInfo) {

                if (jclb.equals("C") && type.equals("C")) {
                    MapCache.set(userInfo.getId() + "_" + FRONT_TABLE_RMOVAL_CJFR_ID, columns);
                } else if (jclb.equals("C") && type.equals("P")) {
                    MapCache.set(userInfo.getId() + "_" + FRONT_TABLE_RMOVAL_CJZRR_ID, columns);
                } else if (jclb.equals("J") && type.equals("C")) {
                    MapCache.set(userInfo.getId() + "_" + FRONT_TABLE_RMOVAL_JLFR_ID, columns);
                } else {
                    MapCache.set(userInfo.getId() + "_" + FRONT_TABLE_RMOVAL_JLZRR_ID, columns);
                }

            } else {

                ExceptionLogger.error("RemovalController#addShowColunms", "未获取到当前用户信息！");
            }

        } else {

            ExceptionLogger.error("RemovalController#addShowColunms", "未获取到当前用户信息！");
        }

        return new RestServiceResult<String>();
    }

    /**
     * 高级检索文件导出
     *
     * @param jclb      奖惩类别：C:惩戒，J:激励
     * @param type      主体类型：C：法人 P:自然人
     * @param condition 查询条件
     * @param columnEN  字段名
     * @param page      分页条件
     * @param response
     * @throws IOException
     */
    @ResponseBody
    @RequestMapping(value = "/export.json")
    public RestServiceResult export(@RequestParam(value = "jclb", defaultValue = "", required = true) String jclb,
                                    @RequestParam(value = "type", defaultValue = "", required = true) String type,
                                    @RequestParam(value = "condition", defaultValue = "", required = true) String condition,
                                    @RequestParam(value = "columnEN", defaultValue = "", required = true) String columnEN, Page page,
                                    HttpServletRequest request, HttpServletResponse response) throws IOException {
        RestServiceResult<SysUser> user = lhjcRemoteBaseService.getCurrentUser(HttpServletHelper.getUserToken(request));
        SysUser userInfo = null;

        if (RestServiceResult.CODE_SUCCESS == user.getCode()) {
            userInfo = user.getData();
            if (null != userInfo) {

            } else {
                ExceptionLogger.error("IntegratedQueryController#export", "未获取到当前用户信息！");
                return new RestServiceResult(RestServiceResult.CODE_UNKNOW, "未获取到当前用户信息！");
            }
        } else {
            ExceptionLogger.error("IntegratedQueryController#export", "未获取到当前用户信息！");
            return new RestServiceResult(RestServiceResult.CODE_UNKNOW, "未获取到当前用户信息！");
        }

        page.setLimit(1000);

        List<String> columns = JSONArray.parseArray(columnEN, String.class);

        List<Map<String, Object>> data = removalService.selectByConditionForPage(officeService.selectTopDeptId(userInfo.getOfficeId() + ""), jclb, type, columns,
                null, condition, page);

        List<OptionalColumn> optionalColumns = null;

        String excelName = "";
        if (jclb.equals("C") && type.equals("C")) {
            optionalColumns = RemovalCjFrTableFieldEnum.getOptionalColumns();
            excelName = "法人联合惩戒名单移出";
        } else if (jclb.equals("C") && type.equals("P")) {
            optionalColumns = RemovalCjZrrTableFieldEnum.getOptionalColumns();
            excelName = "自然人联合惩戒名单移出";
        } else if (jclb.equals("J") && type.equals("C")) {
            optionalColumns = RemovalJlFrTableFieldEnum.getOptionalColumns();
            excelName = "法人联合激励名单移出";
        } else {
            optionalColumns = RemovalJlZrrTableFieldEnum.getOptionalColumns();
            excelName = "自然人联合激励名单移出";
        }

        ExcelUtil.downloadExcel(response, data, excelName, excelName, columns, optionalColumns);

        return new RestServiceResult(RestServiceResult.CODE_SUCCESS, "导出成功");
    }

    /**
     * 联合奖惩超期失效
     *
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/exceedFailureTask.do")
    public RestServiceResult<Object> exceedFailureTask() {
        RestServiceResult<Object> result = new RestServiceResult<Object>();
        try {
            lhjcExceedFailureSchedule.run();
            return result;
        } catch (Exception e) {
            ExceptionLogger.error("RemovalController#exceedFailureTask", "联合奖惩超期失效定时任务异常！ERROR：" + e.getMessage(), e);
            result.setCode(RestServiceResult.CODE_UNKNOW);
            result.setMsg("联合奖惩超期失效定时任务异常！");
            return result;
        }
    }
}
